<template>
  <div>
    <el-card shadow="never">
      <el-menu :default-active="active" router>
        <el-menu-item v-for="item in menu" :key="item.path" :index="item.path">
          <i :class="item.icon"></i>
          <span slot="title">{{ item.title }}</span>
        </el-menu-item>
      </el-menu>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'AppSidebar',
  data () {
    return {
      menu: [
        {
          title: '最新动态',
          icon: 'el-icon-star-off',
          path: '/'
        },
        {
          title: '社交圈',
          icon: 'el-icon-mobile-phone',
          path: '/social'
        },
        {
          title: '博客列表',
          icon: 'el-icon-edit-outline',
          path: '/blog'
        },
        {
          title: '开源项目',
          icon: 'el-icon-service',
          path: '/project'
        }
      ]
    }
  },
  computed: {
    active () {
      return this.$route.path
    }
  },
}
</script>
